//
//  UIView+ViewController.swift
//  CYSinaWB
//
//  Created by mac on 16/2/28.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

extension UIView {
    //遍历视图的响应者链条 获取导航视图控制器
    func navViewController() -> UINavigationController? {
        //遍历视图的响应者链条
        //获取视图的下一个响应者
        var next = nextResponder()
        while next != nil {
            if let nextObj = next as? UINavigationController {
                return nextObj
            }
            next = next?.nextResponder()
        }
        return nil
    }
}
